package pcjavanet.mobilesell.service;

import java.util.List;

import pcjavanet.mobilesell.model.Shop; 
import pcjavanet.mobilesell.model.PageBean;
import pcjavanet.mobilesell.model.ShopExample;
import pcjavanet.mobilesell.model.QryCondition;
import pcjavanet.mobilesell.model.QryTerm;
import pcjavanet.mobilesell.persistence.ShopMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


@Service
public class ShopService {


  @Autowired
  private  ShopMapper shopMapper;


  public int  insert( Shop shop ) throws Exception{
	return shopMapper.insert (shop);
  }


  public Shop  selectByPrimaryKey( Shop  bean ) {
 	int dbid = bean.getDbid();
	Shop shop = shopMapper.selectByPrimaryKey( dbid );
	return shop ;
  }


  public int  updateByPrimaryKeySelective( Shop shop ) throws Exception{
	return shopMapper.updateByPrimaryKeySelective( shop );
  }


  public int  deleteByPrimaryKey( Shop  bean ) throws Exception{
 	int dbid = bean.getDbid();
	return shopMapper.deleteByPrimaryKey( dbid );
  }


  public List<Shop>  selectByExample( Shop shop ) throws Exception{
    ShopExample example = new ShopExample();
	return shopMapper.selectByExample( example );
  }

  public List<Shop>  getOnePageBeans( QryCondition condition , PageBean pageBean ) throws Exception{
    ShopExample example = new ShopExample();
    ServiceUtil.dealCriteria( condition,  example.createCriteria() );
	List<Shop> ls=shopMapper.getOnePageBeans( example , pageBean );
//begin
	if ( ls.size() > 0 ) {
	}
//end
	return ls;
  }

  public int getTotalRecords( QryCondition condition , PageBean pageBean ) throws Exception{
    ShopExample example = new ShopExample();
    ServiceUtil.dealCriteria( condition,  example.createCriteria() );
	return shopMapper.getTotalRecords( example , pageBean );
  }

  public int countByExample( Shop shop , PageBean pageBean ){
    ShopExample example = new ShopExample();
	return shopMapper.countByExample( example );
  }
  public List<Shop> selectByExamplePage( Shop shop , PageBean pageBean ){
  ShopExample example = new ShopExample();
	return shopMapper.selectByExamplePage( example , pageBean );
  }

}
